/*
 * @lc app=leetcode.cn id=455 lang=swift
 *
 * [455] 分发饼干
 */

// @lc code=start
class Solution {
    func findContentChildren(_ g: [Int], _ s: [Int]) -> Int {
        let gs = g.sorted()
        let ss = s.sorted()

        var child: Int = 0
        var cookie: Int = 0
        while child < gs.count && cookie < ss.count {
            if gs[child] <= ss[cookie] {
                child += 1
            }
                cookie += 1

        }
        return child
    }
}
// @lc code=end

